From: Ian Jackson Date: Thu, 27 Nov 2014 18:04:29 +0000 (+0000) Subject: libxl: events: Tear down SIGCHLD machinery on ctx destruction X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4019 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/?a=commitdiff_plain;h=5a9682574538e7cc1b59c17af19ced628ccfe594;p=xen.git libxl: events: Tear down SIGCHLD machinery on ctx destruction We want to have no fd events registered when we are idle. Also, we should put back the default SIGCHLD handler. So: * In libxl_ctx_free, use libxl_childproc_setmode to set the mode to the default, which is libxl_sigchld_owner_libxl (ie `libxl owns SIGCHLD only when it has active children'). But of course there are no active children at libxl teardown so this results in libxl__sigchld_notneeded: the ctx loses its interest in SIGCHLD (unsetting the SIGCHLD handler if we were the last ctx) and deregisters the per-ctx selfpipe fd. * assert that this is the case: ie that we are no longer interested in the selfpipe. Signed-off-by: Ian Jackson Acked-by: Ian Campbell Tested-by: Ian Campbell Release-Acked-by: Konrad Rzeszutek Wilk --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index a2386215b5..8f06043c75 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -162,11 +162,12 @@ int libxl_ctx_free(libxl_ctx *ctx) while ((eject = LIBXL_LIST_FIRST(&CTX->disk_eject_evgens))) libxl__evdisable_disk_eject(gc, eject); + libxl_childproc_setmode(CTX,0,0); for (i = 0; i < ctx->watch_nslots; i++) assert(!libxl__watch_slot_contents(gc, i)); assert(!libxl__ev_fd_isregistered(&ctx->watch_efd)); libxl__ev_fd_deregister(gc, &ctx->evtchn_efd); - libxl__ev_fd_deregister(gc, &ctx->sigchld_selfpipe_efd); + assert(!libxl__ev_fd_isregistered(&ctx->sigchld_selfpipe_efd)); /* Now there should be no more events requested from the application: */